using System;

namespace RPGLibrary.ItemClasses
{
    public class Weapon : BaseItem
    {
        public Hands NumberHands { get; protected set; }
        public int AttackValue { get; protected set; }
        public int AttackModifier { get; protected set; }
        public int DamageValue { get; protected set; }
        public int DamageModifier { get; protected set; }

        public Weapon(
            string weaponName,
            string weaponType,
            int price,
            float weight,
            Hands hands,
            int attackValue,
            int attackModifier,
            int damageValue,
            int damageModifier,
            params string[] allowableClasses)
            : base(weaponName, weaponType, price, weight, allowableClasses)
        {
            NumberHands = hands;
            AttackValue = attackValue;
            AttackModifier = attackModifier;
            DamageValue = damageValue;
            DamageModifier = damageModifier;
        }

        public override object Clone()
        {
            string[] allowedClasses = new string[allowableClasses.Count];
            for (int i = 0; i < allowableClasses.Count; i++)
            {
                allowedClasses[i] = allowableClasses[i];
            }

            Weapon weapon = new Weapon(
                Name,
                Type,
                Price,
                Weight,
                NumberHands,
                AttackValue,
                AttackModifier,
                DamageValue,
                DamageModifier,
                allowedClasses);

            return weapon;
        }

        public override string ToString()
        {
            string weaponString = base.ToString() + ", ";
            weaponString += NumberHands + ", ";
            weaponString += AttackValue.ToString() + ", ";
            weaponString += AttackModifier.ToString() + ", ";
            weaponString += DamageValue.ToString() + ", ";
            weaponString += DamageModifier.ToString();

            foreach (string s in allowableClasses)
            {
                weaponString += ", " + s;
            }

            return weaponString;
        }
    }
}